<?php
/**
 * 公众号用户地址信息接口
 * @author lss
 * 2017-03-02
 */
namespace soa\mp;

use soa\client;

class Address  extends client
{
    /**
     * 服务地址
     * @var string
     */
    public $service_url = 'http://mp.kuaidihelp.com/';

    /**
     * 服务名称
     * @var string
     */
    protected $service_name = 'kuaidihelp_mp';

	//获取最新更新过的地址
	public function getLastUpdate($openid,$platform,$extraInfo = []){
		return $this->post("api/Address/getLastUpdate",[
			"openid" => $openid,
			"platform" => $platform,
			"extra_info" => $extraInfo,
		]);
	}

	//添加地址
	public function add($openid,$platform,$info){
		return $this->post("api/Address/add",array_merge([
			"openid" => $openid,
			"platform" => $platform,
		],$info));
	}

	//更新地址
	public function update($id,$openid,$platform,$info){
		return $this->post("api/Address/add",array_merge([
			"id" => $id,
			"openid" => $openid,
			"platform" => $platform,
		],$info));
	}

	//获取列表
	public function getList($openid,$platform,$limit = [],$orderBy  = "create_time DESC",$extraInfo = []){
		return $this->post("api/Address/getList",[
			"openid" => $openid,
			"platform" => $platform,
			"limit" => $limit,
			"order_by" => $orderBy,
			"extra_info" => $extraInfo,
		]);
	}
}